using System;
using System.Collections.Generic;
using System.Text;

namespace Acms.DataControls
{
    public class GenericDataSourceView<Item> : System.Web.UI.DataSourceView   
    {
        public GenericDataSourceView(GenericDataSource<Item> owner, string viewName) : base(owner, viewName)
        {
            this.owner = owner;
        }

        GenericDataSource<Item> owner;

        protected override System.Collections.IEnumerable ExecuteSelect(System.Web.UI.DataSourceSelectArguments arguments)
        {
            return owner.ExecuteSelect(arguments);
        }

        protected override int ExecuteInsert(System.Collections.IDictionary values)
        {
            return owner.ExecuteInsert(values);
        }

        protected override int ExecuteUpdate(System.Collections.IDictionary keys, System.Collections.IDictionary values, System.Collections.IDictionary oldValues)
        {
            return owner.ExecuteUpdate(keys, values, oldValues);
        }

        protected override int ExecuteDelete(System.Collections.IDictionary keys, System.Collections.IDictionary oldValues)
        {
            return owner.ExecuteDelete(keys, oldValues);
        }

        protected override void OnDataSourceViewChanged(EventArgs e)
        {
            base.OnDataSourceViewChanged(e);
        }

        public override bool CanPage
        {
            get
            {
                return owner.EnablePaging;
            }
        }

        public override bool CanRetrieveTotalRowCount
        {
            get
            {
                return owner.EnablePaging;
            }
        }
    }
}
